1 <table height="28" cellSpacing="0" cellPadding="0" width="100%" border="0">
2       <tr align=center>
3         <td
class="title" width="100%" height="17">
4         S&#
7843;n ph&#7849;m &#273;&#7863;c tr&#432;ng : </td>
5       </tr>
6     </table>
7 <?
8     
switch ($_GET['action'])
9     {
10         
case 'del' :
11             $id = $_GET[
'id'];
12             $sql =
"delete from pro_good where pro_id='".$id."'";
13             @$result = mysql_query($sql,$con);
14             
if ($result) echo "<p align=center class='err'>&#272;ã xóa thành công</p>";
15             
else echo "<p align=center class='err'>Không th&#7875; xóa d&#7919; li&#7879;u</p>";
16             
break;
17     }
18 ?>
19
20 <?
21     
if (isset($_POST['ButDel'])) {
22         $cnt=
0;
23         
foreach ($_POST['chk'] as $id)
24         {
25             @$result = mysql_query(
"delete from pro_good where pro_id='".$id."'",$con);
26             
if ($result) $cnt++;
27         }
28         echo
"<p align=center class='err'>&#272;ã xóa ".$cnt." ph&#7847;n t&#7917;</p>";
29     }
30 ?>
31 <?
32     $page = $_GET[
"page"];
33     $p=
0;
34     
if ($page!='') $p=$page;
35 ?>
36 <form method=
"POST" action="<? echo $_SERVER[PHP_SELF]; ?>" name="frmList">
37 <input type=hidden name=
"page" value="<? echo $page; ?>">
38 <?
39 function taotrang($sql,$link,$nitem,$itemcurrent)
40 {
global $con;
41     $ret=
"";
42     $result = mysql_query($sql, $con) or die(
'Error' . mysql_error());
43     $
value = mysql_fetch_array($result);
44     $plus = (($
value['cnt'] % $nitem)>0);
45     
for ($i=0;$i<($value[0] / $nitem) + plus;$i++)
46     {
47         
if ($i<>$itemcurrent) $ret .= "<a href=\"".$link.$i."\" class=\"lslink\">".($i+1)."</a> ";
48         
else $ret .= ($i+1)." ";
49     }
50     
return $ret;
51 }
52     $pageindex=taotrang(
"select count(*) from pro_good","./?act=pro_good&cat=".$_REQUEST['cat']."&page=",$MAXPAGE,$page);
53 ?>
54
55 <table cellspacing=
"0" cellpadding="0" width="100%">
56 <?
if ($_REQUEST['code']==1) echo '<tr><td colspan="2" align="center" class="err">&#272;ã c&#7853;p nh&#7853;t thành công</td></tr>'; ?>
57 <tr>
58 <td
class="smallfont">Trang : <? echo $pageindex; ?></td>
59 </tr>
60 </table>
61
62 <table border=
"1" cellpadding="2" style="border-collapse: collapse" bordercolor="#C9C9C9" width="100%" id="AutoNumber1">
63   <tr>
64     <td align=center nowrap
class="title"><input type="checkbox" name="chkall" onclick="chkallClick(this);"></td>
65     <td nowrap
class="title">&nbsp;</td>
66     <td nowrap
class="title">&nbsp;</td>
67     <td align=
"center" nowrap class="title"><b>Mã s&#7843;n ph&#7849;m</b></td>
68     <td align=
"center" nowrap class="title"><b>Tên s&#7843;n ph&#7849;m</b></td>
69     <td align=
"center" nowrap class="title"><b>Th&#7913; t&#7921; s&#7855;p x&#7871;p</b></td>
70     <td align=
"center" nowrap class="title"><b>Không hi&#7875;n th&#7883;</b></td>
71     <td align=
"center" nowrap class="title"><b>Ngày</b></td>
72   </tr>
73   
74   <?
75                 $sql=
"select *,DATE_FORMAT(pro_dateadded,'%d/%m/%Y %h:%m') as dateformat from pro_good order by pro_id limit ".($p*$MAXPAGE).",".$MAXPAGE;
76                 $result=mysql_query($sql,$con);
77                 $i=
0;
78                 
while(($row=mysql_fetch_array($result)))
79                 {
80                     $i++;
81                     
if ($i%2) $color="#d5d5d5"; else $color="#e5e5e5";
82                     $proinfo=GetProductInfo($row[
'products_id']);
83   ?>
84   
85   <tr>
86     <td width=
"20" align="center" bgcolor="<? echo $color; ?>" class="smallfont">
87     <input type=
"checkbox" name="chk[]" value="<? echo $row['pro_id']; ?>"></td>
88     <td width=
"20" bgcolor="<? echo $color; ?>" class="smallfont">
89     <a href=
"./?act=pro_good_m&id=<? echo $row['pro_id']; ?>&page=<? echo $page?>">
90     S&#
7917;a</a></td>
91     </td>
92     <td width=
"20" bgcolor="<? echo $color; ?>" class="smallfont">
93     <a onclick=
"return confirm('B&#7841;n có ch&#7855;c ch&#7855;n mu&#7889;n xoá ?');" href="./?act=pro_good&action=del&page=<? echo $_REQUEST['page']; ?>&id=<? echo $row['pro_id']; ?>">
94     Xóa</a></td>
95     <td width=
"20" bgcolor="<? echo $color; ?>" align="left" width="55" align="left" class="smallfont"><? echo $row['products_id']; ?>&nbsp;</td>
96     <td bgcolor=
"<? echo $color; ?>" class="smallfont"><? echo $proinfo['products_name']; ?>&nbsp;</td>
97     <td width=
"80" bgcolor="<? echo $color; ?>" class="smallfont"><? echo $row['pro_sortorder']; ?>&nbsp;</td>
98     <td width=
"80" bgcolor="<? echo $color; ?>" class="smallfont"><? echo $row['pro_status']; ?>&nbsp;</td>
99     <td width=
"100" bgcolor="<? echo $color; ?>" class="smallfont"><? echo $row['dateformat']; ?>&nbsp;</td>
100   </tr>
101   <?
102                 }
103   ?>
104 </table>
105 <input type=
"submit" value="Xóa Ch&#7885;n" name="ButDel" onclick="return confirm('B&#7841;n có ch&#7855;c ch&#7855;n mu&#7889;n xoá ?');" class="button" style="padding: 0">
106 <input type=
"hidden" name="act" value="pro_good">
107 </form>
108 <script language=
"JavaScript">
109 function chkallClick(o) {
110     
var form = document.frmList;
111     
for (var i = 0; i < form.elements.length; i++) {
112         
if (form.elements[i].type == "checkbox" && form.elements[i].name!="chkall") {
113             form.elements[i].
checked = document.frmList.chkall.checked;
114         }
115     }
116 }
117 </script>



Full source code website bán hàng thương mại điện tử gần giống shopee 468.917 lượt xem

Gõ tìm kiếm nhanh...